# Group Panel Permissions

 This Group's APIs are used to list, create, delete or update Panel Permissions.

## Panel Permissions Collections [/v1/panel-permissions]


### List All Panel Permissions [GET]
Get a list of all Panel Permissions.

+ Request

    + Headers

            Accept: application/vnd.api+json
            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
            "meta": {
                "count": 10
            },
            "links": {
                "self": "/v1/panel-permissions"
            },
            "data": [
                {
                    "links": {
                        "self": "/v1/panel-permissions/1"
                    },
                    "id": "1",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "sales"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/1/custom-system-roles",
                                "self": "/v1/panel-permissions/1/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                },
                {
                    "links": {
                        "self": "/v1/panel-permissions/2"
                    },
                    "id": "2",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "admin"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/2/custom-system-roles",
                                "self": "/v1/panel-permissions/2/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                },
                {
                    "links": {
                        "self": "/v1/panel-permissions/3"
                    },
                    "id": "3",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "events"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/3/custom-system-roles",
                                "self": "/v1/panel-permissions/3/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                },
                {
                    "links": {
                        "self": "/v1/panel-permissions/4"
                    },
                    "id": "4",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "sessions"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/4/custom-system-roles",
                                "self": "/v1/panel-permissions/4/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                },
                {
                    "links": {
                        "self": "/v1/panel-permissions/5"
                    },
                    "id": "5",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "users"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/5/custom-system-roles",
                                "self": "/v1/panel-permissions/5/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                },
                {
                    "links": {
                        "self": "/v1/panel-permissions/6"
                    },
                    "id": "6",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "permissions"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/6/custom-system-roles",
                                "self": "/v1/panel-permissions/6/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                },
                {
                    "links": {
                        "self": "/v1/panel-permissions/7"
                    },
                    "id": "7",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "messages"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/7/custom-system-roles",
                                "self": "/v1/panel-permissions/7/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                },
                {
                    "links": {
                        "self": "/v1/panel-permissions/8"
                    },
                    "id": "8",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "reports"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/8/custom-system-roles",
                                "self": "/v1/panel-permissions/8/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                },
                {
                    "links": {
                        "self": "/v1/panel-permissions/9"
                    },
                    "id": "9",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "settings"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/9/custom-system-roles",
                                "self": "/v1/panel-permissions/9/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                },
                {
                    "links": {
                        "self": "/v1/panel-permissions/10"
                    },
                    "id": "10",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "content"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/10/custom-system-roles",
                                "self": "/v1/panel-permissions/10/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                }
            ],
            "jsonapi": {
                "version": "1.0"
            }
        }

### Create Panel Permission [POST]
Create a new panel permission using a name.

+ Request

    + Headers

            Content-Type: application/vnd.api+json
            Authorization: JWT <Auth Key>

    + Body

            {
                "data": {
                    "attributes": {
                        "can-access": true,
                        "panel-name": "marketing"
                    },
                    "type": "panel-permission"
                }
            }

+ Response 201 (application/vnd.api+json)

        {
            "links": {
                "self": "/v1/panel-permissions/1"
            },
            "data": {
                "links": {
                    "self": "/v1/panel-permissions/1"
                },
                "id": "11",
                "attributes": {
                    "can-access": true,
                    "panel-name": "marketing"
                },
                "relationships": {
                    "custom-system-roles": {
                        "links": {
                            "related": "/v1/panel-permissions/1/custom-system-roles",
                            "self": "/v1/panel-permissions/1/relationships/custom-system-roles"
                        }
                    }
                },
                "type": "panel-permission"
            },
            "jsonapi": {
                "version": "1.0"
            }
        }

## Panel Permission Details [/v1/panel-permissions/{panel_permission_id}]
+ Parameters
    + panel_permission_id: 1 (integer) - ID of the panel permission in the form of an integer.

### Get Details [GET]
Get a single panel permission.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
            "links": {
                "self": "/v1/panel-permissions/1"
            },
            "data": {
                "links": {
                    "self": "/v1/panel-permissions/1"
                },
                "id": "10",
                "attributes": {
                    "can-access": true,
                    "panel-name": "content"
                },
                "relationships": {
                    "custom-system-roles": {
                        "links": {
                            "related": "/v1/panel-permissions/1/custom-system-roles",
                            "self": "/v1/panel-permissions/1/relationships/custom-system-roles"
                        }
                    }
                },
                "type": "panel-permission"
            },
            "jsonapi": {
                "version": "1.0"
            }
        }

### Update Panel Permission [PATCH]
+ `id` (integer) - ID of the panel permission to update **(required)**

 Update a single panel permission by setting the name and/or access type.


+ Request (application/vnd.api+json)


    + Headers

            Authorization: JWT <Auth Key>

    + Body

            {
                "data": {
                    "attributes": {
                        "can-access": true,
                        "panel-name": "contents"
                    },
                "type": "panel-permission",
                "id": "1"
                }
            }

+ Response 200 (application/vnd.api+json)

        {
            "links": {
                "self": "/v1/panel-permissions/1"
            },
            "data": {
                "links": {
                    "self": "/v1/panel-permissions/1"
                },
                "id": "1",
                "attributes": {
                    "can-access": true,
                    "panel-name": "contents"
                },
                "relationships": {
                    "custom-system-roles": {
                        "links": {
                            "related": "/v1/panel-permissions/1/custom-system-roles",
                            "self": "/v1/panel-permissions/1/relationships/custom-system-roles"
                        }
                    }
                },
                "type": "panel-permission"
            },
            "jsonapi": {
                "version": "1.0"
            }
        }

### Delete Panel Permission [DELETE]
Delete a single panel permission.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>

+ Response 200 (application/vnd.api+json)

        {
          "meta": {
            "message": "Object successfully deleted"
          },
          "jsonapi": {
            "version": "1.0"
          }
        }


## Get Panel Permission Details for a Custom System Role [/v1/custom-system-roles/{custom_system_role_id}/panel-permissions]
+ Parameters
    + custom_system_role_id: 1 (integer) - ID of the custom system role in the form of an integer.


### Get Panel Permission Details for a Custom System Role [GET]
Get the details of the panel permission.

+ Request

    + Headers

            Accept: application/vnd.api+json

            Authorization: JWT <Auth Key>


+ Response 200 (application/vnd.api+json)

        {
            "meta": {
                "count": 1
            },
            "links": {
                "self": "/v1/panel-permissions"
            },
            "data": [
                {
                    "links": {
                        "self": "/v1/panel-permissions/1"
                    },
                    "id": "1",
                    "attributes": {
                        "can-access": true,
                        "panel-name": "sales"
                    },
                    "relationships": {
                        "custom-system-roles": {
                            "links": {
                                "related": "/v1/panel-permissions/1/custom-system-roles",
                                "self": "/v1/panel-permissions/1/relationships/custom-system-roles"
                            }
                        }
                    },
                    "type": "panel-permission"
                }
            ],
            "jsonapi": {
                "version": "1.0"
            }
        }
